package com.fxd.crm.web.controller.grade;

import com.fxd.crm.model.*;
import com.fxd.crm.service.ICourseOrderService;
import com.fxd.crm.service.ICourseService;
import com.fxd.crm.service.IGradeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @auther fuxudong
 * @date 2021/4/3 - 14:03
 */
@RestController
@RequestMapping("/grade")
public class gradeBodyController {
    @Autowired
    IGradeService gradeService;

    @Autowired
    ICourseService courseService;

    /**
     * page:显示当前页
     * limit：每次显示多少条
     *
     * @return
     */
    @RequestMapping("listjson")
    public PageResult<grade> listJson(grade grade, int page, int limit) {
        PageResult<grade> pageResult = gradeService.findPageResult(grade, page, limit);
        return pageResult;
    }

    @RequestMapping("save")
    public curdResult save(grade grade) {
        curdResult curdResult;
        curdResult = new curdResult(1, "成功");
        gradeService.save(grade);
        return curdResult;
    }

    @RequestMapping("update")
    public curdResult update(grade grade) {
        curdResult curdResult;
        curdResult = new curdResult(1, "成功");
        gradeService.update(grade);
        return curdResult;
        }


}

